package d0320;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyFile {
    public static void main(String[] args) {
        FileOutputStream fos = null;
        FileInputStream fis = null;
        int n = 0;
        try {
            fis = new FileInputStream("src/d0320/data.txt");
            fos = new FileOutputStream("src/d0320/data1.txt");
            byte[] buffer=new byte[1024];
            while ((n = fis.read(buffer,0,buffer.length)) != -1) {
                fos.write(buffer,0,n);
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                fis.close();
                fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}